/**
 * <p>Package : org.tea.springdata.web</p>
 * <p>E-Mail : ztlyde@gmail.com</p>
 */
package org.tea.springdata.web;

import org.springframework.ui.ModelMap;

/**
 * controller基类, 提供子类一些常用的方法
 * @author: John zhang
 * @version: 0.1
 */
public abstract class BaseController {

	protected static final String RESPONSE_SUCCESS_KEY = "success";
	protected static final String RESPONSE_MSG_KEY = "msg";

	protected void success(ModelMap model, String msg) {
		model.addAttribute(RESPONSE_SUCCESS_KEY, true);
		model.addAttribute(RESPONSE_MSG_KEY, msg);
	}

	protected void error(ModelMap model, String msg) {
		model.addAttribute(RESPONSE_SUCCESS_KEY, false);
		model.addAttribute(RESPONSE_MSG_KEY, msg);
	}
}
